namespace SimpleWebServices.Web.Mvc
{
    using System;
    using System.Globalization;
    using System.Web.Mvc;
    using SimpleWebServices.Globalization;
    using SimpleWebServices.Models;

    public abstract class TenantController : ResourceController
    {
        public ViewResult HtmlView(CultureInfo language, object model)
        {
            return this.View(language, Tenant.Current.MasterPages["html"], model);
        }

        public ViewResult View(CultureInfo language, string master, object model)
        {
            if (null != master && 0 == master.Length)
            {
                throw new ArgumentOutOfRangeException("master");
            }

            language.SetCurrentCulture();

            return this.View(null as string, master, model);
        }

        public ViewResult XhtmlView(CultureInfo language, object model)
        {
            return this.View(language, Tenant.Current.MasterPages["xhtml"], model);
        }
    }
}